package com.auxiliary;

import java.util.ArrayList;
import java.util.List;

import com.myidis.entity.QuotaData;

public class TimeSequence {

	private int quota;
	private int dataCount;
	private int frequency;
	private ArrayList<String> dateList;
	private ArrayList<Double> valueList;
	private int  QuotaDataType;


	public TimeSequence() {
		this.quota = 0;
		this.dataCount = 0;
		this.dateList = new ArrayList<String>();
		this.valueList = new ArrayList<Double>();
		this.frequency = 1;
	}
	
	public TimeSequence(ArrayList<QuotaData> dataList) {
		this();
		
		this.quota = dataList.size() > 0? dataList.get(0).getQuota(): 1;
		this.frequency = dataList.size() > 0? dataList.get(0).getFrequency(): 1;
		for(QuotaData data: dataList) {
			dateList.add(data.getTime());
			valueList.add(data.getValue());
			dataCount++;
		}
	}

	public void Rebuild(ArrayList<QuotaData> datas) {
		this.quota = datas.size() > 0 ? datas.get(0).getQuota() : 1;
		this.frequency = datas.size() > 0 ? datas.get(0).getFrequency() : 1;
		for (QuotaData data : datas) {
			dateList.add(data.getTime());
			valueList.add(data.getValue());
			dataCount++;
		}
	}

	public boolean SetTimeSequenceValue(ArrayList<String> dateList, ArrayList<Double> valueList)
    {
        if (dateList == null || valueList == null || dateList.size() != valueList.size())
            return false;
        this.setDateList(dateList);
        this.setValueList(valueList);

        return true;
    }

	public void ChangeValue(String s, Double d) {

	}
	
	public int getQuota() {
		return quota;
	}

	public void setQuota(int quota) {
		this.quota = quota;
	}

	public String getStartDate() {
		return dateList.get(0);
	}

	public String getEndDate() {
		return dateList.get(dataCount);
	}

	public int getDataCount() {
		return dataCount;
	}

	public void setDataCount(int dataCount) {
		this.dataCount = dataCount;
	}

	public int getFrequency() {
		return frequency;
	}

	public void setFrequency(int frequency) {
		this.frequency = frequency;
	}

	public ArrayList<String> getDateList() {
		return dateList;
	}

	public void setDateList(ArrayList<String> dateList) {
		this.dateList = dateList;
	}

	public ArrayList<Double> getValueList() {
		return valueList;
	}

	public void setValueList(ArrayList<Double> valueList) {
		this.valueList = valueList;
	}

	public int getQuotaDataType() {
		return QuotaDataType;
	}


}
